class Song < ActiveRecord::Base
  belongs_to :album
  has_many :userSongComments
  validates_presence_of :name
  validates_presence_of :artist
  validates_presence_of :album
  validates_presence_of :length
  validates_length_of :name, :within => 1..32
  validates_length_of :artist, :within => 1..32
  validates_length_of :length, :within => 1..11

  def self.search(search)
    search = "%" + search + "%"
    find(:all, :conditions => ['name LIKE ?', search])
  end
end
